<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StaffRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'realname'        => 'required',
            'department'      => 'required',
            'position'        => 'required',
            'phone'           => 'required|regex:/[0-9]{11}/',
            'openid'          => 'required',
        ];
    }
    public function messages()
    {
        return [
            'realname.required'    => '请输入姓名',
            'department.required'  => '请选择部门',
            'position.required'    => '请选择职位',
            'phone.required'       => '请输入手机号',
            'openid.required'      => '请输入openid',
            'phone.regex'          => '手机号格式不正确',
        ];
    }
}
